package com.ruoyi.web.controller.school;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.student.domain.SysUserTeacher;
import com.ruoyi.student.domain.vo.SelectListVo;
import com.ruoyi.student.service.ISysUserTeacherService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 老师相关操作
 */
@RestController("SchoolTeacherController")
@RequestMapping("/admin/school/teacher")
public class TeacherController extends BaseController {


    @Resource
    public ISysUserTeacherService sysUserTeacherService;


    /**
     * 获取正常用户的列表
     */
    @GetMapping(value = "/normal/selectlist")
    public AjaxResult list() {
        List<SysUserTeacher> query = sysUserTeacherService.searchTeacherList(null);
        List<SelectListVo> list = new ArrayList<>();
        for (SysUserTeacher item : query) {
            SelectListVo dto = new SelectListVo();
            dto.setLabel(item.getNickName()); //用户姓名
            dto.setValue(item.getUserName()); //用户账号
            dto.setExt(item.getUserName());//备注
            list.add(dto);
        }
        return success(list);
    }

}
